package com.zx.base.widget;

import android.app.Activity;
import android.app.AlertDialog;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RatingBar;
import android.widget.TextView;

import com.zx.tradeclient.R;


public class CommentDialog {

	private String dialog_tile;
	private String dialog_yes;
	private String dialog_no;

	private Activity act;

	private boolean is_parent = false;

	public AlertDialog dlg;
	
	public Button bt_yes, bt_no;
	public EditText editor;
	public RatingBar ratbar;

	public CommentDialog(Activity act, String tile, String yes,
			String no, boolean is_parent) {
		this.act = act;
		dialog_tile = tile;
		dialog_yes = yes;
		dialog_no = no;
		this.is_parent = is_parent;
	}

	public void show() {
		
		if (is_parent) {
			dlg = new AlertDialog.Builder(act.getParent()).create();
		} else {
			dlg = new AlertDialog.Builder(act).create();
		}
		dlg.setCanceledOnTouchOutside(false);
		dlg.setView(act.getLayoutInflater().inflate(R.layout.app_comment_dialog, null), 0, 0, 0, 0);
		dlg.show();
		Window window = dlg.getWindow();
		
		TextView tv_title = (TextView) window.findViewById(R.id.coment_dialog_tile);
		tv_title.setText(dialog_tile);
		
		editor=(EditText)window.findViewById(R.id.coment_dialog_say);
		
		
		bt_yes = (Button) window.findViewById(R.id.coment_dialog_sub);
		bt_yes.setText(dialog_yes);
		
		bt_no = (Button) window.findViewById(R.id.coment_dialog_no);
		bt_no.setText(dialog_no);
		
	}

}
